import request from '@/utils/request'
// 抽取出来方便后面使用
const apiUrl = '/admin/product/category'

/**
 * 导入excel文件
 */
export const uploadExcel = (data) => {
    return request({
        url: `${apiUrl}/uploadExcel`,
        method: 'post',
        responseType:'blob', //用于处理二进制数据
        data
    })
}
/**
 * 导出excel文件
 * @returns {AxiosPromise}
 */
export const exportExcel = () => {
    return request({
        url: `${apiUrl}/excelExport`,
        method: 'get',
        responseType:'blob' //用于处理二进制数据
    })
}
/**
 * 根据parent id查询 下属子级分类
 * @param pid
 * @returns {*}
 */
export const getCategoryListByParentId = (pid) => {
    return request({
        url: `${apiUrl}/getCategoryListByParentId/${pid}`,
        method: 'get'
    })
}